package cn.njupt;

public class Test {

    static void test1() {
        Trie trie = new Trie();
        trie.insert("cat");
        trie.insert("dog");
        trie.insert("catalog");
        trie.insert("cast");
        trie.insert("小码哥");
        Asserts.test(trie.size() == 5);
        Asserts.test(trie.startsWith("do"));
        Asserts.test(trie.startsWith("c"));
        Asserts.test(trie.startsWith("ca"));
        Asserts.test(trie.startsWith("cat"));
        Asserts.test(trie.startsWith("cata"));
        Asserts.test(!trie.startsWith("hehe"));
        trie.delete("cat"); ;
        trie.delete("catalog") ;
        trie.delete("cast") ;
        Asserts.test(trie.size() == 2);
        Asserts.test(trie.startsWith("小"));
        Asserts.test(trie.startsWith("do"));
        Asserts.test(!trie.startsWith("c"));
    }

    public static void main(String[] args) {
        test1();
    }

}
